<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>关闭订单接口测试</title>
    <link href="../css/weui.min.css" rel="stylesheet">
    <link href="../css/example.css" rel="stylesheet">
</head>
<body ontouchstart>
    <div class="page__hd">
        <h1 class="page__title">
            关闭订单接口
        </h1>
        <p class="page__desc">请输入订单号进行关闭</p>
        <p class="page__desc" id="result"></p>
    </div>
    <div class="page__bd">
        <div class="weui-cells__title">订单号</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <input class="weui-input" id="outTradeNo" type="number" required pattern="[0-9]*" placeholder="请输入订单号"/>
                </div>
            </div>
        </div>
        <div class="weui-btn-area">
            <a href="javascript:;" id="close" class="weui-btn weui-btn_primary">关闭订单</a>
        </div>
    </div>
    <div class="page__ft"></div>
    <script src="../js/jquery-1.9.1.min.js"></script>
    <script>
        $("#close").click(function () {
            var outTradeNo = $("#outTradeNo").val();
            if(!outTradeNo) {
                $("#result").text("请输入订单号");
                return;
            }
            $(this).hide();
            $("#result").text("正在关闭...");
            // 调用关闭接口
            $.ajax({
                url: "/wxpay/closeOrder/doCloseOrder.do",
                dataType:'json',
                data: {outTradeNo : outTradeNo},
                type: "POST",
                success:function(data){
                    $("#result").text(JSON.stringify(data));
                    $("#close").show();
                },
                error:function () {
                    alert("error");
                }
            });
        });
    </script>
</body>
</html>